<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="../common/include/header.jsp" %>
<%-- 커뮤니티 메뉴 페이지 --%>
<div width="980px">
<table border="0" cellpadding="0" cellspacing="0" width="980px">
	<tr>
		<td style="vertical-align: top;width: 180px;background-color: #fdb32a;">
			<%@ include file="adminmenu.jsp"%>
		</td>
		<td style="width: 800px;text-align: center;">
			<div style="width: 800px;padding-top: 10px; padding-bottom: 10px;">
				<table style="width: 800px;" cellpadding="0" cellspacing="0">
				<tr><td style="width: 600px;vertical-align: top;">
			<div style="padding-bottom: 10px;">	<img src="<%=imagePath %>commadmin_menu_02.jpg" border="0"/></div>
			<table style="width: 500px;vertical-align: top;border: 1px solid #fdb32a;" cellpadding="0" cellspacing="0">
				<tr>
					<td style="width: 600px;vertical-align: top;">
						<%int count=0;%>
						<logic:notEmpty name="menu" property="freeBoardMenus" scope="session">
							<table style="width: 500px;text-align: center;" cellpadding="0" cellspacing="0">
								<tr><td colspan="3" style="width: 500px;"><img src="<%=imagePath %>commadmin_menu_04.jpg" border="0"/></td></tr>
							<logic:iterate id="fbmenues" name="menu" property="freeBoardMenus" scope="session">
								<tr>
									<td style="width: 400px;height: 20px;">
										<input type="text" id="newname<%=count%>" value="<bean:write name="fbmenues" property="bname"/>" style="width: 380px;height: 12px;font-size: 8pt;"></td>
									<td style="width: 50px;text-align: right;">
										<img src="<%=imagePath %>commadmin_menu_10.jpg" onclick="fbchangename('<bean:write name="fbmenues" property="bname"/>','<%=count++%>')" onmouseover="javascript:this.style.cursor='hand';" /></td>
									<td style="width: 50px;text-align: right;">
										<img src="<%=imagePath %>commadmin_menu_11.jpg"  onclick="fbdel('<bean:write name="fbmenues" property="bname"/>')" onmouseover="javascript:this.style.cursor='hand';" /></td>
								</tr>								
							</logic:iterate>
							</table>
						</logic:notEmpty>
						<logic:notEmpty name="menu" property="dataBoardMenus" scope="session">
							<table style="width: 500px;text-align: center;" cellpadding="0" cellspacing="0">
								<tr><td colspan="3" style="width: 500px;"><img src="<%=imagePath %>commadmin_menu_05.jpg" border="0"/></td></tr>
							<logic:iterate id="dbmenues" name="menu" property="dataBoardMenus" scope="session">
								<tr>
									<td style="width: 400px;height: 20px;">
										<input type="text" id="newname<%=count%>" value="<bean:write name="dbmenues" property="bname"/>" style="width: 380px;height: 12px;font-size: 8pt;"></td>
									<td style="width: 50px;text-align: right;">
										<img src="<%=imagePath %>commadmin_menu_10.jpg"   onclick="dbchangename('<bean:write name="dbmenues" property="bname"/>','<%=count++%>')"  onmouseover="javascript:this.style.cursor='hand';" /></td>
									<td style="width: 50px;text-align: right;">
										<img src="<%=imagePath %>commadmin_menu_11.jpg" onclick="dbdel('<bean:write name="dbmenues" property="bname"/>')"  onmouseover="javascript:this.style.cursor='hand';" /></td>
								</tr>
							</logic:iterate>
							</table>
						</logic:notEmpty>
						<logic:notEmpty name="menu" property="photoBoardMenus" scope="session">
							<table style="width: 500px;text-align: center;" cellpadding="0" cellspacing="0">
								<tr><td colspan="3" style="width: 500px;"><img src="<%=imagePath %>commadmin_menu_06.jpg" border="0"/></td></tr>
							<logic:iterate id="pbmenues" name="menu" property="photoBoardMenus" scope="session">
								<tr>
									<td style="width: 400px;">
										<input type="text" id="newname<%=count%>" value="<bean:write name="pbmenues" property="bname"/>" style="width: 380px;height: 12px;font-size: 8pt;"></td>
									<td style="width: 50px;text-align: right;">
										<img src="<%=imagePath %>commadmin_menu_10.jpg" onclick="pbchangename('<bean:write name="pbmenues" property="bname"/>','<%=count++%>')" onmouseover="javascript:this.style.cursor='hand';" />
									<td style="width: 50px;text-align: right;">
										<img src="<%=imagePath %>commadmin_menu_11.jpg"  onclick="pbdel('<bean:write name="pbmenues" property="bname"/>')" onmouseover="javascript:this.style.cursor='hand';" /></td>
								</tr>
							</logic:iterate>
							</table>
						</logic:notEmpty>
					</td>
				</tr>
				<tr>
					<td style="padding: 5px;">
					<hr/>
						<table style="width: 480px;text-align: center;border: 1px solid #fdb32a;padding: 5px;" cellpadding="0" cellspacing="0">
							<tr>
								<td class="commMenuTd" style="width: 200px;"><img src="<%=imagePath %>commadmin_menu_08.jpg" border="0"/></td>
								<td class="commMenuTd" style="width: 260px;"><input type="text" id="fbnew" class="commMenuInput">
									<img src="<%=imagePath %>commadmin_menu_09.jpg" border="0" onclick="fbnew()" onmouseover="javascript:this.style.cursor='hand';"/></td>
							</tr>
							<tr>
								<td class="commMenuTd" style="width: 200px;"><img src="<%=imagePath %>commadmin_menu_13.jpg" border="0"/></td>
								<td class="commMenuTd" style="width: 260px;"><input type="text" id="dbnew" class="commMenuInput">
									<img src="<%=imagePath %>commadmin_menu_09.jpg" border="0" onclick="dbnew()" onmouseover="javascript:this.style.cursor='hand';"/></td>
							</tr>
							<tr>
								<td class="commMenuTd" style="width: 200px;"><img src="<%=imagePath %>commadmin_menu_15.jpg" border="0"/></td>
								<td class="commMenuTd" style="width: 260px;"><input type="text" id="pbnew" class="commMenuInput">
									<img src="<%=imagePath %>commadmin_menu_09.jpg" border="0" onclick="pbnew()" onmouseover="javascript:this.style.cursor='hand';"/></td>
							</tr>
						</table>
					</td>
				</tr>				
			</table>
			</td>
			<td style="height: 500px;width: 200px;"><img src="<%=imagePath %>commadmin_info_04.jpg" border="0"/></td>
			</tr>
				</table>
			</div>
		</td>		
	</tr>
</table>
<script type="text/javascript">
	//자유게시판 이름을 변경할때
	function fbchangename(bname,count){
		var bn = decodeURIComponent(bname);
		var nn = 'newname'+count;
		var nn2 = document.getElementById(nn).value;

		if(nn2.replace(/\s/g,'') !=''){
			var newname = decodeURIComponent(nn2);
			location.href = "<%=path%>/community/communityinfo.do?method=fbChangeName&bname="+escape(encodeURIComponent(bn))+"&cono=<%=request.getParameter("cono")%>&newname="+escape(encodeURIComponent(newname));			
		}else{
			alert('수정할 이름을 넣어주세요');
		}
	}
	
	//자유게시판을 삭제할 때
	function fbdel(bname){
		var bn = decodeURIComponent(bname);
		location.href = "<%=path%>/community/communityinfo.do?method=fbDel&bname="+escape(encodeURIComponent(bn))+"&cono=<%=request.getParameter("cono")%>";			
	}
	
	//자유게시판을 생성할 때
	function fbnew(){
		var name = document.getElementById('fbnew').value;
		var reconame = name.replace(/\s/g,'');
		if(reconame != ''){
			var bn = decodeURIComponent(name);
			location.href = "<%=path%>/community/communityinfo.do?method=fbNew&bname="+escape(encodeURIComponent(bn))+"&cono=<%=request.getParameter("cono")%>";
		}else{
			alert('내용을 입력해 주세요');
		}	
	}
	
	//자료실 이름 변경할 때
	function dbchangename(bname,count){
		var bn = decodeURIComponent(bname);
		var nn = 'newname'+count;
		var nn2 = document.getElementById(nn).value;
		if(nn2.replace(/\s/g,'') !=''){
			var newname = decodeURIComponent(nn2);
			location.href = "<%=path%>/community/communityinfo.do?method=dbChangeName&bname="+escape(encodeURIComponent(bn))+"&cono=<%=request.getParameter("cono")%>&newname="+escape(encodeURIComponent(newname));			
		}else{
			alert('수정할 이름을 넣어주세요');
		}
	}
	
	//자료실 삭제할 떄
	function dbdel(bname,count){
		var bn = decodeURIComponent(bname);
		location.href = "<%=path%>/community/communityinfo.do?method=dbDel&bname="+escape(encodeURIComponent(bn))+"&cono=<%=request.getParameter("cono")%>";			
	}
	
	//자료실 생성할 때
	function dbnew(){		
		var name = document.getElementById('dbnew').value;
		var reconame = name.replace(/\s/g,'');
		if(reconame != ''){
			var bn = decodeURIComponent(name);
			location.href = "<%=path%>/community/communityinfo.do?method=dbNew&bname="+escape(encodeURIComponent(bn))+"&cono=<%=request.getParameter("cono")%>";
		}else{
			alert('내용을 입력해 주세요');
		}	
	}
	
	//포토게시판 이름 변경할 때
	function pbchangename(bname,count){
		var bn = decodeURIComponent(bname);
		var nn = 'newname'+count;
		var nn2 = document.getElementById(nn).value;
		if(nn2.replace(/\s/g,'') !=''){
			var newname = decodeURIComponent(nn2);
			location.href = "<%=path%>/community/communityinfo.do?method=pbChangeName&bname="+escape(encodeURIComponent(bn))+"&cono=<%=request.getParameter("cono")%>&newname="+escape(encodeURIComponent(newname));			
		}else{
			alert('수정할 이름을 넣어주세요');
		}
	}
	
	//포토게시판 삭제할 때
	function pbdel(bname,count){	
		var bn = decodeURIComponent(bname);
		location.href = "<%=path%>/community/communityinfo.do?method=pbDel&bname="+escape(encodeURIComponent(bn))+"&cono=<%=request.getParameter("cono")%>";			
	}
	
	//포토게시판 생성할 때
	function pbnew(){		
		var name = document.getElementById('pbnew').value;
		var reconame = name.replace(/\s/g,'');
		if(reconame != ''){
			var bn = decodeURIComponent(name);
			location.href = "<%=path%>/community/communityinfo.do?method=pbNew&bname="+escape(encodeURIComponent(bn))+"&cono=<%=request.getParameter("cono")%>";
		}else{
			alert('내용을 입력해 주세요');
		}	
	}

</script>
</div>
<%@ include file="../common/include/footer.jsp" %>